﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using CE.Global;

public partial class user_AjaxSessionUpdate : MyLanguageBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] != null 
            || Session[CE.Global.General.CarId] != null
            || Session[CE.Global.General.Guest] != null)
        {
            //string sKey = CE.Configuration.MyConfigurationManager.GetAppSettingValue("UserCacheName");
            //sKey += Convert.ToString(Session[CE.Global.General.UserId].ToString()); ;

            //// Accessing the Cache Item extends the Sliding Expiration automatically
            //if (HttpContext.Current.Cache[sKey] != null)
            //{
            //    string sUser = (string)HttpContext.Current.Cache[sKey];
            //}
            //else
            //{
            //    TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
            //    HttpContext.Current.Cache.Insert(sKey, Session[CE.Global.General.UserId].ToString(), null, DateTime.MaxValue, SessTimeOut,
            //       System.Web.Caching.CacheItemPriority.NotRemovable, null);
            //}
            if (Session[CE.Global.General.UserId] != null)
            {
                CE.Global.General.CreateUpdateUserLoginCached(Page);
            }

            Response.ContentType = "text/html";
            Response.Write("Session Updated - Server Time:" + DateTime.Now.ToString());
        }
    }
}
